The invention relates generally to a transaction processing system, and more particularly to incorporating collateral activity as a participant in a transaction.
A transaction most often is defined as an explicitly delimited operation, or set of related operations, that change or otherwise modify the content of an information collection (e.g., database) from one consistent state to another. Changes are treated as a single unit in that all changes of a transaction are formed and made permanent (the transaction is xe2x80x9ccommittedxe2x80x9d) or none of the changes are made permanent (the transaction is xe2x80x9cabortedxe2x80x9d). If a failure occurs during the execution of a transaction, resulting in the transaction being aborted, whatever partial changes were made to the collection can be undone so that the information collection remains in a consistent state.
Often, it is desired that certain activity be associated with a transaction, but performed after the transaction is completed. For example, an application executing a transaction may desire to verify that the transaction is consistent under certain policy guidelines or rules. Consider a transaction processing system structured to maintain a company database that includes information respecting the company""s employees, including payroll. Consider a change to the payroll information for a particular employee such as implementing a raise in the employee""s salary. Then, the payroll information change is checked or verified to see that it was made pursuant to company guidelines. In the past that payroll change would then be made and committed (made persistent) before the change (raise in salary) is checked. If such guidelines were exceeded, the change is typically undone.
While effective, calling upon such collateral activity after the transaction has been completed can be time-consuming, particularly if the collateral activity or check requires that the preceding change be withdrawn.
Accordingly, there is a need to incorporate collateral activity within the bounds of a data processing transaction before the transaction completed and make persistent.
The present invention provides, in the context of a transaction, a resource that performs collateral activity (i.e., activity not directly related to a change of an information collection), allowing it for example to participate in the transaction as a xe2x80x9cvotingxe2x80x9d member. Thus, the collateral activity can participate in the decision of whether or not the change should be made.
Broadly, according to the present invention, when an application process initiates a transaction, it can also employ a collateral process to perform work that is not directly related to a change of state in the information collection (hereinafter xe2x80x9cdatabasexe2x80x9d) but is able to participate in that transaction. The invention is employed in the context of transaction management provided by a transaction monitor facility (TMF) operable to protect the integrity of user data maintained in the database, particularly when the state of that database is changed. According to the invention, the collateral process may be called by an application as part of a transaction. When called, the collateral process can request participation in the transaction as a voting member by making a call to TMF_Export, an application programming interface (API). The call will provide the called API with the identities of the calling process and the transaction in which participation is desired. Among the tasks performed by the API is one that functions to xe2x80x9cregisterxe2x80x9d a calling process with an identified transaction. A registered process allows it to become a participant in the transaction and can vote in the two-phase commit protocol performed when the end transaction aspect is reached.
Typically, the transaction is monitored and tracked by a TMF, and preferably concludes using a two-phase commit protocol. Typically also, the TMF initiates the conclusion of a transaction by sending a xe2x80x9cPreparexe2x80x9d signal. In reply, registered participants of the transaction return xe2x80x9cReadyxe2x80x9d signals, indicating that they made the necessary preparations to make the change persistent. When the collateral process receives the xe2x80x9cPreparexe2x80x9d signal, it will perform its collateral activity. When that collateral activity is complete, the collateral process will either return a xe2x80x9cReadyxe2x80x9d signal, indicating that the collateral activity completed successfully, or returned an xe2x80x9cAbortxe2x80x9d signal, indicating that the collateral activity did not complete successfully or that the change in the database being made by the transaction violated some policy or guideline.
A conventional transaction control block (TCB) data structure is formed when the transaction is initiated. The TCB data structure is basically a public container, with some private fields, that provides a description of the associated transaction. The TCB data structure includes the identity of each participant in the transaction, thereby identifying the resources that will receive the xe2x80x9cPreparexe2x80x9d signal when the end transaction stage is reached. Therefore, in addition to those participants of which the TMF normally has cognizance, i.e., those whose operation will result in the change of the database, a process may join as a participant by calling the TMF_Export function. That function will, in turn, notify TMF that the calling process desires participation, and TMF will write the identity of the calling process to the TCB data structure of the associated transaction.
A number of advantages are achieved by the present invention. By including collateral activity in the context of the transaction, that collateral activity can be performed in parallel and concluded with the transaction to improve efficiency and linearity of operation.
In addition, should the collateral activity so indicate, undoing the transaction at the behest of the collateral activity can be performed at a stage before the change of state of the database is made persistent.
These and other aspects and advantages of the invention will become apparent to those skilled in the art upon a reading of the following detailed description of the invention, which should be taken in conjunction with the accompanying drawings.